package com.rabbit.eap.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rabbit.eap.system.entity.SysDept;
import com.rabbit.eap.system.param.SysDeptPageParam;
import com.rabbit.eap.system.vo.SysDeptVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;
import java.util.Set;

/**
 * @projectName eap
 * @packageName com.rabbit.eap.system.mapper
 * @className SysDeptMapper
 * @author： rabbit
 * @version： 1.0
 * @since： 2020/06/06 23:34:02
 * <p>Description:
 * 部门表 Mapper 接口
 * </p>

 */
@Repository
public interface SysDeptMapper extends BaseMapper<SysDept> {

    /**
     * 根据ID获取查询对象
     *
     * @param id
     * @return
     */
    SysDeptVO getSysDeptById(Serializable id);

    /**
     * 获取分页对象
     *
     * @param page
     * @param sysDeptPageParam
     * @return
     */
    IPage<SysDeptVO> getSysDeptPageList(@Param("page") Page page, @Param("param") SysDeptPageParam sysDeptPageParam);

    String getAncestorsName(List list);

    List<SysDept> selectChildrenDeptById(Long deptId);

    void updateDeptChildren(@Param("depts") List<SysDept> depts);

    List<SysDept> getSysDeptList(@Param("param") SysDeptPageParam sysDeptPageParam);

    List<Integer> getDeptListByRoleId(Long roleId);

    Set<String> getRoleDept(@Param("roleId") Long roleId);
}
